{% extends "base.html" %}

{% block title %}添加用户 - 管理系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0">添加用户</h4>
            </div>
            <div class="card-body">
                <form method="POST" action="{{ url_for('admin.add_user') }}">
                    <div class="mb-3">
                        <label for="username" class="form-label">用户名</label>
                        <input type="text" class="form-control" id="username" name="username" required>
                    </div>
                    <div class="mb-3">
                        <label for="password" class="form-label">密码</label>
                        <input type="password" class="form-control" id="password" name="password" required>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">角色</label>
                        {% for role in roles %}
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="roles" value="{{ role.id }}" id="role{{ role.id }}">
                            <label class="form-check-label" for="role{{ role.id }}">
                                {{ role.name }} - {{ role.description }}
                            </label>
                        </div>
                        {% endfor %}
                    </div>
                    <button type="submit" class="btn btn-primary">添加用户</button>
                    <a href="{{ url_for('admin.users') }}" class="btn btn-secondary">返回</a>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %} 